# with: 会自动帮我们关闭文件资源(传统方式的简写)
with open("/opt/d.txt", mode="w") as fw1:
    fw1.write("Guishu niu pi~")

# fw.writelines(列表): 将列表中的每一个元素写到指定的文件中
fw = open("/opt/c.txt", mode="w")
line_list = ["hello\n", "world", "my\n", "baby girl"]
fw.writelines(line_list)
fw.close()
